<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html" xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:a="http://richfaces.org/a4j">
<body>
<ui:composition template="/WEB-INF/template.xhtml">

    <ui:define name="body">
        <span class="current_header">Авторизация</span> → Адрес доставки → Подверждение
        <br /><br />


        <div style="width: 100%;">

            <f:subview id="no_order" rendered="#{currentOrder==null}">
                <p>Ваша корзина пуста. Подберите себе что-нибудь.</p>
            </f:subview>


            <f:subview id="auth" rendered="#{currentOrder != null}">
                <h:form id="AuthActionForm" styleClass="authForm">

                    <h:messages globalOnly="true" layout="table" styleClass="errors"/>
                    <s:validateAll>




                        <s:decorate template="edit.xhtml" id="email">
                            <ui:define name="label">Ваша электронная почта</ui:define>
                            <h:inputText id="email-input" value="#{identity.username}" size="36"
                                         title="Например: order@sozvezdie-store.ru"
                                            disabled="#{checkout.authType == 3}" styleClass="#{checkout.authType == 3 ? 'disabled' : ''}">
                                <a:support event="onblur" reRender="email"/>
                            </h:inputText>
                        </s:decorate>

                        <h:panelGrid columns="2">
                                          
                            <h:selectOneRadio layout="pageDirection" value="#{checkout.authType}">
                                <a:support event="onchange" reRender="email-input, password" />
                                <f:selectItem itemLabel="Вы новый покупатель" itemValue="1" />
                                <f:selectItem itemLabel="Вы уже наш клиент, введите пароль" itemValue="2" />
                                <f:selectItem itemLabel="Вы не хотите вводить свою эл. почту" itemValue="3"  />
                            </h:selectOneRadio>
                            
                            <h:inputSecret id="password" value="#{identity.password}" size="36" disabled="#{checkout.authType != 2}" styleClass="#{checkout.authType != 2 ? 'disabled' : ''}"/>

                        </h:panelGrid>


                        



                    </s:validateAll>

                    <br/>
                    <h:commandButton id="BackButton"
                                     type="submit"
                                     action="back"
                                     value="Вернуться"
                                     styleClass="backward-button" style="font-size: 14pt;" />

                    &#160; &#160;
                    <h:commandButton id="SubmitAuthButton"
                                     type="submit"
                                     action="#{checkout.auth}"
                                     value="#{messages.submitAuthButton}"
                                     styleClass="forward-button" style="font-size: 14pt;" /> 
                </h:form>
            </f:subview>

        </div>
    </ui:define>
</ui:composition>
</body>
</html>
